namespace NyMPH.Persistence
{

    /// <summary>
    /// This interface provides the Persistence classes with a known set of methods to use.
    /// </summary>
    public interface IPersistence
    {
        /// <summary>
        /// Save this object to permanent storage.
        /// </summary>
        /// <returns>True if saved, else false.</returns>
        bool Save();

        /// <summary>
        /// Load this object from permanent storage.
        /// </summary>
        /// <returns>True if loaded, else false</returns>
        bool Load();

        /// <summary>
        /// Remove this object from permanent storage
        /// </summary>
        /// <returns></returns>
        bool Delete();

        /// <summary>
        /// Get unique Object ID for this object.
        /// </summary>
        /// <returns></returns>
        int GetOID();

        void Find(Criteria item);
        // void Find(bool item);
        // void Find(Criteria item);

        /// <summary>
        /// This object has been changed from its persisted state
        /// </summary>
        /// <returns>True if the object has changed, else false.</returns>
        bool HasChanges();

        /// <summary>
        /// Sets the HasChanges property
        /// </summary>
        /// <param name="Changed">True if the object has changed since it was last persisted.</param>
        void HasChanges(bool Changed);
    }

    /// <summary>
    /// Defines different persistence states for an object.
    /// </summary>
    public enum PersistenceStates
    {
        /// <summary>
        /// The persistence state is unknown
        /// </summary>
        Unknown = 0,

        /// <summary>
        /// This instance has not been persisted yet because it does not have a valid OID
        /// </summary>
        New = 1,

        /// <summary>
        /// One or more properties of this instance have been changed since the object was last persisted. This is different than the 'New' state because it has a valid OID.
        /// </summary>
        Modified = 2,

        /// <summary>
        /// No changes have been made to any persisted properties since the object was last persisted.
        /// </summary>
        Unchanged = 3,

        /// <summary>
        /// This instance has been deleted from the persistent store but remains in memory.
        /// </summary>
        Deleted = 4
    }
}